﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ControlTemplate x:Key="roundButtonTemplate" TargetType="{x:Type Button}">
        <Grid>
            <Ellipse x:Name="border" Stroke="Gray">
                <Ellipse.Fill>
                    <SolidColorBrush Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background.Color}" />
                </Ellipse.Fill>
            </Ellipse>
            <Ellipse x:Name="whiteHighlight" Stroke="Transparent" Opacity="0.75">
                <Ellipse.Fill>
                    <RadialGradientBrush Center="0.25,0.25">
                        <GradientStop Color="White" Offset="0" />
                        <GradientStop Color="Transparent" Offset="1" />
                    </RadialGradientBrush>
                </Ellipse.Fill>
            </Ellipse>
            <Ellipse x:Name="mouseHighlight" Stroke="Transparent" Opacity="0">
                <Ellipse.Fill>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
                </Ellipse.Fill>
            </Ellipse>
            <Viewbox>
                <ContentPresenter Margin="{TemplateBinding Padding}" />
            </Viewbox>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard TargetName="mouseHighlight" TargetProperty="Opacity">
                            <DoubleAnimation From="0" To="0.2" Duration="0:0:0.25" />
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard TargetName="mouseHighlight" TargetProperty="Opacity">
                            <DoubleAnimation From="0.2" To="0" Duration="0:0:0.25" />
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="whiteHighlight" Property="Opacity" Value="0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="whiteHighlight" Property="Opacity" Value="0" />
                <Setter TargetName="mouseHighlight" Property="Opacity" Value="0" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>